var personModule = require('./person.js');
class Teacher extends personModule.Person{
    constructor(id , name , age , klass){
        super(id , name , age);
        this.klassArray = klass;
    }
    introduce(){
        var classString = (this.klassArray.length == 0) ? 'No Class' :
            ('Class ' + this.klassArray.map(function (item) {
                return item.number;
            }).join(', '));
        var string = super.introduce() + ' I am a Teacher. I teach ' + classString +'.';
        return string;
    }
    isTeaching(student){
        for (var klassObj of this.klassArray){
            if(klassObj.isIn(student)){
                return true;
            }
        }
        return false;
    }
}

module.exports.Teacher = Teacher;